<?php
// +---------------------------------------------
// | Name：星空框架 物流模板模型管理
// +---------------------------------------------
// | Version: V5.0
// +---------------------------------------------
// | Author: xkyinzhe <zhonghuaxinxing@sina.cn>
// +---------------------------------------------
// | Time: 2021-04-20 10:48
// +---------------------------------------------
declare(strict_types=1);

namespace app\common\model;

use think\model\concern\SoftDelete;

/**
 * @xk 物流模板模型管理
 */
class ShippingTemplate extends BaseModel
{
    use SoftDelete;
    protected $name = 'shippingTemplate';
    protected $pk = 'shipping_type_id';
    protected $deleteTime = 'delete_time';
    /**
     * @xk 写入前操作 新增/更新都需要
     *
     * @method onBeforeWrite
     * @param  [type]                  $data                     [description]
     * @return [type]                                            [description]
     * @Author xkyinzhe                <zhonghuaxinxing@sina.cn>
     * @Time   2021-04-21T09:01:39+080
     */
    public static function onBeforeWrite($data)
    {

        unset($data['act']);
        unset($data['controllers']);
        unset($data['actions']);
        if (!$data->create_time) {
            $data->update_time = $data->create_time = date('Y-m-d H:i:s');
        }
    }
}
